The <sub> element in HTML is used to display text as subscript, which appears slightly below the baseline and is usually smaller in size than regular text. It is commonly used for:
✔️ Mathematical expressions (e.g., H₂O)
✔️ Chemical formulas (e.g., CO₂)
✔️ Scientific notations (e.g., E = mc₂)
✔️ Footnotes and references
The <sub> tag is a pair tag, meaning it requires an opening and closing tag
Usage of <sub>
Displaying Chemical Formulas
Mathematical Expressions
Scientific Notation
Footnotes and References
Browser Compatibility
Chrome
Firefox
Edge
Safari
Opera
Internet Explorer
The <sub> element is fully supported across all browsers.
Best Practices
✔️ Use <sub> only for its intended purpose (scientific formulas, mathematical expressions, and footnotes).
✔️ Avoid using <sub> for layout purposes—use CSS instead.
✔️ Ensure that screen readers interpret subscript content correctly by using ARIA attributes if necessary.
CSS Styling for <sub>
If you need to adjust the position or size of the subscript text, you can use CSS:
The <sub> element is a simple yet powerful HTML tag used for scientific, mathematical, and academic purposes. It should be used only when necessary and styled properly using CSS if needed.